import { Injectable } from '@angular/core';
import { Http , Response } from '@angular/http';
import { CatalogItem } from '../models/catalog-model';
import { Observable } from 'rxjs/Rx';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';

@Injectable()
export class CatalogItemService {

    private dataurl = 'src/app/mock-data/catalog-list-data.json';
    constructor(public httpService: Http) {

    }

    public getRemoteCatalogContents(): Observable<CatalogItem[]> {
         return this.httpService.get(this.dataurl)
            .map((res: Response) => res.json());
    }

}